﻿@{
    Layout = "~/Views/Shared/_HomeLayout.cshtml";
    ViewBag.Title = "角色管理";
}
<div class="templatemo-content-widget white-bg">
    <div class="panel panel-default no-border">
        <div class="panel-heading border-radius-10">
            <h2>角色管理</h2>
        </div>
        <div class="panel-body">
            <div class="templatemo-content-widget no-padding">
                <div class="form-group text-right">
                    <a href="/Role/Add" class="templatemo-white-button">新建</a>
                </div>
                <div class="panel panel-default table-responsive">
                    <table class="table table-striped table-bordered templatemo-user-table" id="app">
                        <thead>
                            <tr>
                                <td>序号</td>
                                <td>角色名</td>
                                <td>详情</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="item in items">
                                <td>{{item.Num}}</td>
                                <td>{{item.Name}}</td>
                                <td>
                                    <a href="/Role/Edit?id={{item.Id}}">编辑</a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data: {
            items: []
        },
        ready: function () {
            var _self = this;
            _self.$http.get('/Role/GetRoleList', function (data, status, request) {
                $.each(data, function (i, item) {
                    if (item.Id != 1) {
                        item.Num = i + 1;
                        _self.items.push(item);
                    }
                });
            });
        }
    });
</script>

